<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {
	echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
	exit;
}






if ($_GET['pc'] != NULL || $_GET['pb'] != NULL) {
// pulldown menu brand listings
$sql = sprintf("SELECT * FROM affiliSt_products1 WHERE prodCategory = %s ORDER BY prodBrand ASC",
				quote_smart(str_replace("-", " ", $_GET['pc'])));
$pulldownBrands = mysql_query($sql, $databaseConnect) or die(mysql_error());
$pulldownList = mysql_fetch_assoc($pulldownBrands);

$box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/pulldownbrands.tpl");


	
		
	do {
		$selectresult = ucwords(strtolower($pulldownList['prodBrand']));
			if ($storedSelectBrand != $selectresult) {
			
					if ($navOpt[7] == 1) {
					// html perma
					$box_content->assign("LINKDATA",$installDir['value'].'subproducts/'.str_replace(" ", "-", $pulldownList['prodCategory']).'/'.str_replace(" ", "-", $pulldownList['prodBrand']).'.html');
					} else {
					// php link
					$box_content->assign("LINKDATA",$installDir['value'].'index.php?case=subproducts&pc='.str_replace(" ", "+", $pulldownList['prodCategory']).'&pb='.str_replace(" ", "+", $pulldownList['prodBrand']));
					}
					
					
					$box_content->assign("DATA",$selectresult);
					$box_content->parse("pulldownbrands.option");
					
			$storedSelectBrand = $selectresult;
			} else {
			$selectresult = ucwords(strtolower($pulldownList['prodBrand']));
			}
	
		} while ($pulldownList = mysql_fetch_assoc($pulldownBrands));






} else if ($_GET['nc'] != NULL || $_GET['nb'] != NULL) {
// brand listing
$sql = sprintf("SELECT * FROM affiliSt_categories WHERE parent = %s ORDER BY name ASC",
				quote_smart($_GET['nc']));
$pullDownNB = mysql_query($sql, $databaseConnect) or die(mysql_error());
$NBList = mysql_fetch_assoc($pullDownNB);

$box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/pulldownbrands.tpl");


	
	do {
		$selectresult = ucwords(strtolower($NBList['name']));
			if ($storedSelectBrand != $selectresult) {
			
					$box_content->assign("PULLLINKDATA",'nc='.$NBList['parent']);
					
			
					if ($navOpt[7] == 1) {
					// html perma
					$box_content->assign("LINKDATA",$installDir['value'].'subcategories/'.$NBList['parent'].'/'.$NBList['id'].'/'.urltxt($NBList['name']).'.html');
					} else {
					// php link
					$box_content->assign("LINKDATA",$installDir['value'].'index.php?case=subcategories&nc='.$NBList['parent'].'&nb='.$NBList['id']);
					}
					
					$box_content->assign("DATA",$selectresult);
					$box_content->parse("pulldownbrands.option");
					
			$storedSelectBrand = $selectresult;
			} else {
			$selectresult = ucwords(strtolower($NBList['name']));
			}
	
		} while ($NBList = mysql_fetch_assoc($pullDownNB));
		
		
// search puldown menu
} else if ($_GET['ps'] != NULL) {

$box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/pulldownbrands.tpl");

}






$box_content->assign("DATA", "Please Choose:");
$box_content->assign("SKIN",$configSkin['value']);

if ($_GET['ps'] == NULL) {
$box_content->parse("pulldownbrands");
$box_content = $box_content->text("pulldownbrands");
} else {
$box_content->parse("searchsort");
$box_content = $box_content->text("searchsort");
}
?>